package com.mk.admin.controller;

import com.mk.admin.model.ResultDto;
import com.mk.admin.model.vo.WeChatRefundSelectVo;
import com.mk.admin.model.vo.WeChatRefundVo;
import com.mk.admin.model.vo.WeChatRegisterPayBackVo;
import com.mk.admin.model.vo.WeChatRegisterPayVo;
import com.mk.admin.service.PayService;
import com.mk.admin.service.WeChatPayService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping(value = "/a/adm/weChat")
@Api(tags = "微信支付")
@Slf4j
public class WeChatPayController {

    @Autowired
    private WeChatPayService weChatPayService;

    //    @Autowired
//    private BespeakService bespeakService;
//
//    @ApiOperation("微信支付")//ok
//    @PostMapping(value = "/pay")
//    public Response pay(@RequestBody Map map) throws Exception {
//        return  watchPay.pay(map);
//    }
//
//    @ApiOperation("预约微信支付")//ok
//    @PostMapping(value = "/ordercallpay")
//    public Response ordercallpay(@RequestBody Map map) throws Exception {
//        return  watchPay.ordercallpay(map);
//    }
//
//
//
    @ApiOperation("pay_0330挂号微信支付")//ok
    @PostMapping(value = "/registerPay")
    public ResultDto registerPay(@RequestBody WeChatRegisterPayVo vo) throws Exception {
        return weChatPayService.registerPay(vo);
    }

    //
//    @ApiOperation("微信支付订单查询")//ok
//    @PostMapping(value = "/queryorder")
//    public Response queryorder(@RequestBody Map map) throws Exception {
//        return  watchPay.queryorder(map);
//    }
//
//    @ApiOperation("自主开单微信支付")//ok
//    @PostMapping(value = "/freedompay")
//    public Response freedompay(@RequestBody Map map) throws Exception {
//        return  watchPay.freedompay(map);
//    }
//
//    @ApiOperation("自主开单微信支付回调")//ok
//    @PostMapping(value = "/freedomback")
//    public Response freedomback(@RequestBody Map map) throws Exception {
//        return  watchPay.freedomback(map);
//    }
//
//    @ApiOperation(value = "预约订单回调")
//    @PostMapping(value = "/ordercallback")
//    public Response ordercallback(@RequestBody Map query) throws Exception {
//        Response map = bespeakService.ordercallback(query);
//        return map;
//    }
//
    @ApiOperation(value = "pay_0325挂号回调")
    @PostMapping(value = "/registerBack")
    public ResultDto registerBack(@RequestBody WeChatRegisterPayBackVo vo) throws Exception {

        return weChatPayService.registerBack(vo);
    }

    @ApiOperation(value = "pay_0327退费")
    @PostMapping(value = "/refund")
    public ResultDto refund(@RequestBody WeChatRefundVo vo) throws Exception {

        return weChatPayService.refund(vo);
    }

    @ApiOperation(value = "pay_0328退费查询")
    @PostMapping(value = "/refundSelect")
    public ResultDto refundSelect(@RequestBody WeChatRefundSelectVo vo) throws Exception {

        return weChatPayService.refundSelect(vo);
    }

//    @ApiOperation(value = "处方缴费回调")
//    @PostMapping(value = "/paymentback")
//    public Response recipelback(@RequestBody Map query) throws Exception {
//        Response map = watchPay.recipelback(query);
//        return map;
//    }
//
//    @ApiOperation(value = "管理员退费")
//    @PostMapping(value = "/defray")
//    public Response defrayallback(@RequestBody Map query) throws Exception {
//        Response map = watchPay.defrayallback(query);
//        return map;
//    }
}
